include ../CommonMakefile       #     $(SCALAC) $(J)

PACKAGEDIR=edu/upenn/seas/peerreview/pr
OTHERSRC= ../Common.scala ../Debug.scala  
SRC= $(OTHERSRC) Log.scala PRMessages.scala PRSimple.scala Crypto.scala PRSwitching.scala
TESTSRC= $(wildcard tests/*.scala)
JARNAME=pr.jar
CP     = -classpath .

LIB        = ../lib
SCALATEST  = scalatest-1.0
EASYMOCK   = easymock-2.5.2
EASYMOCKCE = easymockclassextension-2.5.2

LIBJAR      = $(LIB)/$(1)/$(1).jar
SCALACP     = $(LIB)/scala-library.jar
SCALATESTCP = $(call LIBJAR,$(SCALATEST))
EASYMOCKCP  = $(call LIBJAR,$(EASYMOCK))$(J)$(call LIBJAR,$(EASYMOCKCE))$(J)$(LIB)/cglib-nodep-2.2.jar

TESTCP = $(SCALATESTCP)

all: test

.classes: $(SRC)
	$(SCALAC) $(CP) $(SRC)
	@touch .classes

.dev: .classes
	$(SCALAC) $(CP) PRLayer.scala
	@touch .dev

$(JARNAME) : .classes
	jar cf $(JARNAME) $(PACKAGEDIR)/*.class	

stable: .classes $(JARNAME)

test: .dev $(JARNAME) #TEST.out

TEST.out: 	$(TESTSRC) .classes
		$(SCALAC) -cp $(TESTCP) $(TESTSRC)
	  	scala -cp $(TESTCP) org.scalatest.tools.Runner -o -p .
		@touch $@

clean:
	rm -rf edu/ $(JARNAME) .classes TEST.out *.class .dev


.PHONY: stable test clean all
